package com.baize.glinkad.manager;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

import com.baize.glinkad.bean.ADInfo;
import com.baize.glinkad.bean.listener.ADListener;
import com.baize.glinkad.bean.listener.BannerListener;
import com.baize.glinkad.bean.listener.InterstitialListener;
import com.baize.glinkad.bean.listener.RewardVideoListener;
import com.baize.glinkad.bean.listener.SplashListener;
import com.baize.glinkad.utils.ADLogHelper;
import com.baize.glinkad.utils.config.GlinkConfig;

/**
 * 广告管理类
 */
public class ADManager {

    public static ADManager instance;
    public FrameLayout bannerViewGroup;
    public boolean isBannerReady;
    public boolean isInterstitialReady;
    public boolean isVideoReady;
    public GlinkConfig glinkConfig;
    public String posID;

    public void getSplash(Activity activity, ADInfo aDInfo, String str, SplashListener splashListener) {
        ADLogHelper.info("ADManger getSplash");
    }

    public void init(Context context, ADListener aDListener) {
        ADLogHelper.info("ADManger init");
    }

    public void initApplication(Application application) {
        ADLogHelper.info(glinkConfig.getDesc()+"插件未支持-initApplication");
    }

    public void initBanner(Context context, ADInfo aDInfo, String posId) {
        FrameLayout frameLayout;
        if (aDInfo == null || (frameLayout = aDInfo.adView) == null) {
            this.bannerViewGroup = new FrameLayout(context);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
            layoutParams.addRule(10, -1);
            this.bannerViewGroup.setLayoutParams(layoutParams);
        } else {
            this.bannerViewGroup = frameLayout;
        }
        ADLogHelper.info("ADManger initBanner");
    }

    public void initInstitial(Context context, String str) {
        ADLogHelper.info("ADManger initInstitial");
    }

    public void initVideo(Context context, String str) {
        ADLogHelper.info("ADManger initVideo");
    }

    public void loadBanner() {
        ADLogHelper.info("ADManger loadBanner");
    }

    public void loadInterstitial() {
        ADLogHelper.info("ADManger loadInterstitial");
    }

    public void loadRewardedVideoAd() {
        ADLogHelper.info("ADManger loadRewardedVideoAd");
    }

    public void onDestroy(Activity activity) {
        ADLogHelper.info("ADManger onDestroy");
        this.isBannerReady = false;
        this.isInterstitialReady = false;
        this.isVideoReady = false;
    }

    public void onPause(Activity activity) {
        ADLogHelper.info("ADManger onPause");
    }

    public void onResume(Activity activity){
        ADLogHelper.info("ADManger onResume");
    }

    public void setBannerListener(BannerListener bannerListener){
        ADLogHelper.info("ADManger setBannerListener");
    }

    public void setInterstitialListener(InterstitialListener interstitialListener){
        ADLogHelper.info("ADManger setInterstitialListener");
    }

    public void setVideoListener(RewardVideoListener rewardVideoListener){
        ADLogHelper.info("ADManger setVideoListener");
    }

    public void showInterstitialAD() {
        ADLogHelper.info("ADManger showInterstitialAD");
    }

    public void showRewardVideoAD() {
        ADLogHelper.info("ADManger showRewardVideoAD");
    }

    public void setConfig(GlinkConfig glinkConfig) {
        this.glinkConfig = glinkConfig;
    }
}